/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entitys;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Administrator
 */
@Entity
@Table(name = "video")
@NamedQueries({
    @NamedQuery(name = "Video.findAll", query = "SELECT v FROM Video v"),
    @NamedQuery(name = "Video.findById", query = "SELECT v FROM Video v WHERE v.id = :id"),
    @NamedQuery(name = "Video.findByName", query = "SELECT v FROM Video v WHERE v.name = :name"),
    @NamedQuery(name = "Video.findByArtist", query = "SELECT v FROM Video v WHERE v.artist = :artist"),
    @NamedQuery(name = "Video.findByBand", query = "SELECT v FROM Video v WHERE v.band = :band"),
    @NamedQuery(name = "Video.findByMusic", query = "SELECT v FROM Video v WHERE v.music = :music"),
    @NamedQuery(name = "Video.findByYear", query = "SELECT v FROM Video v WHERE v.year = :year"),
    @NamedQuery(name = "Video.findBySrc1", query = "SELECT v FROM Video v WHERE v.src1 = :src1"),
    @NamedQuery(name = "Video.findBySrc2", query = "SELECT v FROM Video v WHERE v.src2 = :src2"),
    @NamedQuery(name = "Video.findBySrc3", query = "SELECT v FROM Video v WHERE v.src3 = :src3"),
    @NamedQuery(name = "Video.findByThumb1", query = "SELECT v FROM Video v WHERE v.thumb1 = :thumb1"),
    @NamedQuery(name = "Video.findByThumb2", query = "SELECT v FROM Video v WHERE v.thumb2 = :thumb2"),
    @NamedQuery(name = "Video.findByAddedBy", query = "SELECT v FROM Video v WHERE v.addedBy = :addedBy"),
    @NamedQuery(name = "Video.findByAddedDate", query = "SELECT v FROM Video v WHERE v.addedDate = :addedDate")})
public class Video implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Size(max = 255)
    @Column(name = "name")
    private String name;
    @Lob
    @Size(max = 65535)
    @Column(name = "description")
    private String description;
    @Size(max = 255)
    @Column(name = "artist")
    private String artist;
    @Size(max = 255)
    @Column(name = "band")
    private String band;
    @Size(max = 255)
    @Column(name = "music")
    private String music;
    @Size(max = 255)
    @Column(name = "year")
    private String year;
    @Size(max = 255)
    @Column(name = "src1")
    private String src1;
    @Size(max = 255)
    @Column(name = "src2")
    private String src2;
    @Size(max = 255)
    @Column(name = "src3")
    private String src3;
    @Size(max = 255)
    @Column(name = "thumb1")
    private String thumb1;
    @Size(max = 255)
    @Column(name = "thumb2")
    private String thumb2;
    @Size(max = 255)
    @Column(name = "added_by")
    private String addedBy;
    @Size(max = 255)
    @Column(name = "added_date")
    private String addedDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "videoid")
    private Collection<VideoComments> videoCommentsCollection;
    @OneToOne(cascade = CascadeType.ALL, mappedBy = "video")
    private Rating rating;
    @OneToMany(mappedBy = "videoid")
    private Collection<Playlist> playlistCollection;

    public Video() {
    }

    public Video(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getArtist() {
        return artist;
    }

    public void setArtist(String artist) {
        this.artist = artist;
    }

    public String getBand() {
        return band;
    }

    public void setBand(String band) {
        this.band = band;
    }

    public String getMusic() {
        return music;
    }

    public void setMusic(String music) {
        this.music = music;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getSrc1() {
        return src1;
    }

    public void setSrc1(String src1) {
        this.src1 = src1;
    }

    public String getSrc2() {
        return src2;
    }

    public void setSrc2(String src2) {
        this.src2 = src2;
    }

    public String getSrc3() {
        return src3;
    }

    public void setSrc3(String src3) {
        this.src3 = src3;
    }

    public String getThumb1() {
        return thumb1;
    }

    public void setThumb1(String thumb1) {
        this.thumb1 = thumb1;
    }

    public String getThumb2() {
        return thumb2;
    }

    public void setThumb2(String thumb2) {
        this.thumb2 = thumb2;
    }

    public String getAddedBy() {
        return addedBy;
    }

    public void setAddedBy(String addedBy) {
        this.addedBy = addedBy;
    }

    public String getAddedDate() {
        return addedDate;
    }

    public void setAddedDate(String addedDate) {
        this.addedDate = addedDate;
    }

    public Collection<VideoComments> getVideoCommentsCollection() {
        return videoCommentsCollection;
    }

    public void setVideoCommentsCollection(Collection<VideoComments> videoCommentsCollection) {
        this.videoCommentsCollection = videoCommentsCollection;
    }

    public Rating getRating() {
        return rating;
    }

    public void setRating(Rating rating) {
        this.rating = rating;
    }

    public Collection<Playlist> getPlaylistCollection() {
        return playlistCollection;
    }

    public void setPlaylistCollection(Collection<Playlist> playlistCollection) {
        this.playlistCollection = playlistCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Video)) {
            return false;
        }
        Video other = (Video) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entitys.Video[ id=" + id + " ]";
    }
    
}
